﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Update_Audio.aspx.cs" Inherits="SQT.tracnghiem.Admin.Update_Audio" %>

<%@ Import Namespace="DataAccess" %>
<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
</head>
<body>
    <%
        var get_audio = new TblLibraryController().FetchAll().Where(x => x.LibraryType == 2 && x.LibraryLink.Contains(".wma"));
    %>
    <table border="1">
        <tr>
            <td>Trước (<%=get_audio.ToList().Count %>)</td>
            <td>Sau</td>
        </tr>
        <%
            foreach (TblLibrary audio in get_audio)
            {
        %>
        <tr>
            <td><%=audio.LibraryLink %></td>

            <%
                string link = audio.LibraryLink;
                string[] split = audio.LibraryLink.Split('.');
                string name = "";
            %>
            <td>
                <%for (int i = 0; i < split.Length - 1; i++)
                  { %>
                <%name += split[i];%><%if (i < split.Length - 2) { name += "."; }
                  } %>
                <%=name+".mp3" %>
                <%new TblLibraryController().Update(audio.LibraryId, null, name, null, null, null, null, null, null, null, null); %>
            </td>
        </tr>
        <%
                
            } %>
    </table>
</body>
</html>
